﻿<%@ Page Title="" Language="C#" MasterPageFile="~/manager.Master" AutoEventWireup="true" CodeBehind="Add_Around.aspx.cs" Inherits="Bus_proj.website.Add_Around" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="../Styles/Stylebuttoncss.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/textbox.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 407px;
        }
        .style3
        {
            width: 234px;
        }
        .style4
        {
            width: 181px;
        }
        .style5
        {
            width: 189px;
        }
        .style6
        {
        }
        .style7
        {
            width: 419px;
        }       
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Button3" EventName="Click" />
    </Triggers>
<fieldset class="el03">
<legend>กำหนดการรอบเดินทาง</legend>

    <asp:Panel ID="Panel1" runat="server">
<fieldset class="el02">
<legend>กำหนดวันเวลาเดินทาง</legend>
<table class="style1">
        <tr>
            <td align="right" class="style2">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label1" runat="server" Text="วัน/เดือน/ปีเริ่มต้น :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server" TextMode="Date" CssClass="textbox"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label2" runat="server" Text="วัน/เดือน/ปีสิ้นสุด :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server" TextMode="Date" CssClass="textbox"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label3" runat="server" Text="เส้นทาง :"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="DropDownList1" runat="server" 
                    DataSourceID="LinqDataSource1" DataTextField="Route_id" 
                    DataValueField="Route_id" Height="23px" Width="83px" CssClass="textbox">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                    ContextTypeName="Bus_proj.DataClasses1DataContext" EntityTypeName="" 
                    TableName="Table_Routes">
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server" Height="36px" Text="ตกลง" 
                    Width="89px" onclick="Button1_Click" CssClass="classname" />
            </td>
        </tr>
    </table>
</fieldset>
    </asp:Panel>  
    

<asp:Panel ID="Panel2" runat="server" Visible="False">
<fieldset class="el02"> 
<legend >ข้อมูลรอบเดินทาง</legend>
        <table class="style1">
            <tr>
                <td align="right" class="style3">
                    &nbsp;</td>
                <td class="style4">
                    &nbsp;</td>
                <td align="right" class="style5">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td align="right" class="style3">
                    <asp:Label ID="Label5" runat="server" Text="วัน/เดือน/ปีเริ่มต้น :"></asp:Label>
                </td>
                <td class="style4">
                    <asp:Label ID="Label9" runat="server" Text="Label"></asp:Label>
                </td>
                <td align="right" class="style5">
                    <asp:Label ID="Label6" runat="server" Text="เลขรอบเดินทาง :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBox3" runat="server" CssClass="textbox" Width="105px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right" class="style3">
                    <asp:Label ID="Label4" runat="server" Text="วัน/เดือน/ปีสิ้นสุด :"></asp:Label>
                </td>
                <td class="style4">
                    <asp:Label ID="Label10" runat="server" Text="Label"></asp:Label>
                </td>
                <td align="right" class="style5">
                    <asp:Label ID="Label7" runat="server" Text="ประเภทรถเดินทาง :"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="DropDownList2" runat="server" 
                        DataSourceID="LinqDataSource2" DataTextField="Type_Bus_name" 
                        DataValueField="Type_Bus_id" Height="22px" Width="108px" 
                        AutoPostBack="True" CssClass="textbox">
                    </asp:DropDownList>
                    <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
                        ContextTypeName="Bus_proj.DataClasses1DataContext" EntityTypeName="" 
                        TableName="Table_Type_Bus">
                    </asp:LinqDataSource>
                </td>
            </tr>
            <tr>
                <td align="right" class="style3">
                    <asp:Label ID="Label11" runat="server" Text="เส้นทาง :"></asp:Label>
                </td>
                <td class="style4">
                    <asp:Label ID="Label12" runat="server" Text="Label"></asp:Label>
                </td>
                <td align="right" class="style5">
                    <asp:Label ID="Label8" runat="server" Text="หมายเลขรถ :"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="DropDownList3" runat="server" 
                        DataSourceID="SqlDataSource1" DataTextField="Bus_number" 
                        DataValueField="Bus_number" Height="21px" Width="103px" 
                        AutoPostBack="True" CssClass="textbox">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:Bus_proConnectionString %>" SelectCommand="select *
from Table_Bus
where Type_Bus_id = @type and Bus_number like @round_chk +'-%'">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="DropDownList2" Name="type" 
                                PropertyName="SelectedValue" />
                            <asp:ControlParameter ControlID="Label12" DefaultValue="" Name="round_chk" 
                                PropertyName="Text" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td align="right" class="style3">
                    &nbsp;</td>
                <td class="style4">
                    &nbsp;</td>
                <td align="right" class="style5">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
 </fieldset>
</asp:Panel>


    <asp:Panel ID="Panel3" runat="server" Visible="False">
<fieldset class="el02">
<legend>ตารางเวลาเดินทาง</legend>
        <table class="style1">
            <tr>
                <td class="style7">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td align="center" class="style6" colspan="2">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE" 
                        BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="Time_id" 
                        DataSourceID="SqlDataSource2" ForeColor="Black" GridLines="Vertical">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField>
                                <EditItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" />
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Time_id" HeaderText="รหัสเวลา" ReadOnly="True" 
                                SortExpression="Time_id" />
                            <asp:BoundField DataField="Route_id" HeaderText="รอบเดินทาง" 
                                SortExpression="Route_id" />
                            <asp:BoundField DataField="Time_time" HeaderText="เวลาเดินทาง" 
                                SortExpression="Time_time" />
                        </Columns>
                        <EmptyDataTemplate>
                            <span style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">
                            ไม่มีเวลาเดินทาง</span>
                        </EmptyDataTemplate>
                        <FooterStyle BackColor="#CCCC99" />
                        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                        <RowStyle BackColor="#F7F7DE" />
                        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#FBFBF2" />
                        <SortedAscendingHeaderStyle BackColor="#848384" />
                        <SortedDescendingCellStyle BackColor="#EAEAD3" />
                        <SortedDescendingHeaderStyle BackColor="#575357" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:Bus_proConnectionString %>" 
                        SelectCommand="SELECT * FROM [Table_Time] WHERE ([Route_id] = @Route_id)">
                        <SelectParameters>
                            <asp:SessionParameter Name="Route_id" SessionField="round_chk" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td align="right" class="style7">
                    <asp:Button ID="Button2" runat="server" OnClientClick="return confirm('ยืนยันการทำรายการ')" Height="36px" onclick="Button2_Click" 
                        style="margin-left: 0px" Text="ตกลง" Width="104px" CssClass="classname" />
                </td>
                <td>
                    <asp:Button ID="Button3" runat="server" OnClientClick="return confirm('ยืนยันการยกเลิกรายการ')" Height="36px" onclick="Button3_Click" 
                        Text="ยกเลิก" Width="108px" CssClass="classname" />
                </td>
            </tr>
        </table>
</fieldset>
</asp:Panel>

</fieldset>
    </ContentTemplate>
    </asp:UpdatePanel>


</asp:Content>
